{include file="public/header" /}

<body class="bgc">
    <div class="header" onClick="goBacklist();">
        <span class="layui-icon layui-icon-left"></span> 交易明细
    </div>

    <ul class="my-order-list tpl_list">
        <li>
            <p class="flex-layout">{$info.type == 2 ?'卖家：'.$info.user.code.'-'.$info.user.nickname.($info.user.mobile?'-'.$info.user.mobile:''):'买家：'.$info.buser.code.'-'.$info.buser.nickname.($info.buser.mobile?'-'.$info.buser.mobile:'')}<span>{$info.statusText}</span></p>
            <div class="b flex-layout" style="height: 1.5rem !important;">
                <div class="time">{$info.type == 2?'卖出':'买入'}时间：{$info.create_time}</div>
            </div>
            <div class="b flex-layout" style="height: 1.5rem !important;">
                <div class="time">单价：{$info.price}</div>
                <div class="time">数量：{$info.num}</div>
                <div class="time">总价：{$info.money}</div>
            </div>
            {if $info.status == 2 || $info.status == 3}
            <div class="flex-layout" style="height: 1.5rem !important;">
                <div>付款方式：{$info.pay_way}</div>
            </div>
            <div class="flex-layout" style="height:auto !important;">
                <a href="javascript:;" style="color: var(--bc) !important;" class="openShowImg" data-value="{$info.images}">
                    <img src="{$info.images??''}" alt="" style="width: 80px; height: 80px;">
                </a>
            </div>
            {/if}
        </li>
    </ul>
    <div class="orderDet-footer">
        {if $info.buy_uid == $user->id}
            {if $info.status == 1} 
            <a href="{:url('deal/payment')}?id={$info.id}" class="bc flex-center">立即付款</a>
            {/if}
        {else}
            {if $info.status == 2} 
            <a href="javascript:;"  class="flex-center" onclick="receipt('{$info.id}');">确认收款</a>
            {/if}
        {/if}
    </div>
</body>
{include file="public/footer"/}
<script>
    function goBacklist() {
        window.location.href = "{:url('deal/my_deal_list')}?type={$Request.param.type?:1}&status={$Request.param.status?:''}";
    }
    function receipt(id){
        edit('receipt', id, '是否确认收款？');
    }
    function edit(type, id, msg) {
        layer.confirm(msg, {title: '请确认'}, function () {
            common.load()
            $.ajax({
                type: 'POST',
                url: '{:url("deal/edit")}',
                data: {type: type, id: id},
                dataType: "json",
                success: function (data) {
                    layer.closeAll;
                    layer.msg(data.msg);
                    if (data.code == 1) {
                        window.location.href = data.url;
                    }
                }
            });
        });
    }
</script>

</html>